package com.wqz.day19_redisdemo.controller;

import com.wqz.day19_redisdemo.entity.Student;
import com.wqz.day19_redisdemo.service.StudentService;
import com.wqz.day19_redisdemo.vo.R;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;

/**
 * (Student)表控制层
 *
 * @author 王乾州
 * @since 2025-10-20 19:39:14
 */
@RestController
@RequestMapping("students")
public class StudentController {
    /**
     * 服务对象
     */
    @Resource
    private StudentService studentService;



    @PostMapping
    public R insertStudent(@RequestBody Student student) {
        return studentService.addStudent(student);
    }

    @GetMapping("{id}")
    public R getStudent(@PathVariable Long id) {
        return studentService.selectStudentById(id);
    }


}

